```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Dubbo与Javassist：高性能字节码生成的艺术</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #1e293b;
            line-height: 1.6;
        }
        .hero {
            background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        }
        .title-font {
            font-family: 'Noto Serif SC', serif;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight {
            position: relative;
            z-index: 1;
        }
        .highlight:after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 40%;
            background-color: rgba(59, 130, 246, 0.2);
            z-index: -1;
            transform: scaleX(0);
            transform-origin: right;
            transition: transform 0.3s ease-out;
        }
        .highlight:hover:after {
            transform: scaleX(1);
            transform-origin: left;
        }
        .drop-cap:first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 0.75;
            margin: 0.1em 0.15em 0 0;
            color: #3b82f6;
            font-weight: 700;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:py-32">
        <div class="container mx-auto max-w-5xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="title-font text-4xl md:text-5xl lg:text-6xl font-bold leading-tight mb-4">
                        <span class="highlight">Dubbo</span>与<span class="highlight">Javassist</span>
                    </h1>
                    <p class="text-xl md:text-2xl text-blue-100 mb-8">高性能字节码生成的艺术</p>
                    <p class="text-blue-100 mb-8">探索分布式服务框架背后的核心技术选择</p>
                    <div class="flex space-x-4">
                        <button class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition duration-300">
                            <i class="fas fa-book mr-2"></i>深入了解
                        </button>
                        <button class="border border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:text-blue-600 transition duration-300">
                            <i class="fas fa-code mr-2"></i>查看源码
                        </button>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="relative w-64 h-64 md:w-80 md:h-80">
                        <div class="absolute inset-0 bg-blue-500 rounded-full opacity-20 animate-pulse"></div>
                        <div class="absolute inset-4 bg-blue-400 rounded-full opacity-30 animate-pulse delay-100"></div>
                        <div class="absolute inset-8 bg-blue-300 rounded-full opacity-40 animate-pulse delay-200"></div>
                        <div class="absolute inset-12 bg-white rounded-full flex items-center justify-center">
                            <i class="fas fa-cogs text-blue-600 text-5xl md:text-7xl"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Introduction -->
    <section class="py-16 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="bg-white rounded-xl shadow-lg p-8 md:p-12">
                <p class="text-xl md:text-2xl text-gray-700 mb-8 drop-cap">Dubbo作为阿里巴巴开源的分布式服务框架，其高性能的核心秘密之一在于对字节码生成技术的精妙选择。本文将深入剖析Dubbo默认使用Javassist作为字节码生成工具的原因及其技术优势。</p>
                
                <div class="flex flex-wrap -mx-4 mb-12">
                    <div class="w-full md:w-1/3 px-4 mb-8 md:mb-0">
                        <div class="bg-blue-50 rounded-lg p-6 h-full">
                            <div class="text-blue-600 text-4xl mb-4">
                                <i class="fas fa-bolt"></i>
                            </div>
                            <h3 class="text-xl font-bold mb-2">性能优越</h3>
                            <p class="text-gray-600">直接操作字节码，生成效率高于JDK Proxy和CGLIB</p>
                        </div>
                    </div>
                    <div class="w-full md:w-1/3 px-4 mb-8 md:mb-0">
                        <div class="bg-blue-50 rounded-lg p-6 h-full">
                            <div class="text-blue-600 text-4xl mb-4">
                                <i class="fas fa-wrench"></i>
                            </div>
                            <h3 class="text-xl font-bold mb-2">易于使用</h3>
                            <p class="text-gray-600">高级API简化开发，无需深度理解字节码结构</p>
                        </div>
                    </div>
                    <div class="w-full md:w-1/3 px-4">
                        <div class="bg-blue-50 rounded-lg p-6 h-full">
                            <div class="text-blue-600 text-4xl mb-4">
                                <i class="fas fa-cubes"></i>
                            </div>
                            <h3 class="text-xl font-bold mb-2">完美契合</h3>
                            <p class="text-gray-600">与Dubbo的服务调用场景高度匹配</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <section class="py-16 px-4">
        <div class="container mx-auto max-w-5xl">
            <div class="grid md:grid-cols-3 gap-8">
                <!-- Table of Contents -->
                <div class="md:col-span-1">
                    <div class="bg-white rounded-xl shadow-lg p-6 sticky top-8">
                        <h2 class="text-2xl font-bold mb-6 text-gray-800 border-b pb-2">目录</h2>
                        <ul class="space-y-3">
                            <li>
                                <a href="#section1" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                                    <i class="fas fa-chevron-right mr-2 text-sm"></i> 高效的字节码生成
                                </a>
                            </li>
                            <li>
                                <a href="#section2" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                                    <i class="fas fa-chevron-right mr-2 text-sm"></i> 易于使用
                                </a>
                            </li>
                            <li>
                                <a href="#section3" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                                    <i class="fas fa-chevron-right mr-2 text-sm"></i> 与Dubbo的契合度
                                </a>
                            </li>
                            <li>
                                <a href="#section4" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                                    <i class="fas fa-chevron-right mr-2 text-sm"></i> 成熟度和社区支持
                                </a>
                            </li>
                            <li>
                                <a href="#section5" class="flex items-center text-blue-600 hover:text-blue-800 transition">
                                    <i class="fas fa-chevron-right mr-2 text-sm"></i> 与其他工具的对比
                                </a>
                            </li>
                        </ul>
                        <div class="mt-6 pt-4 border-t">
                            <h3 class="text-sm font-semibold text-gray-500 mb-2">技术标签</h3>
                            <div class="flex flex-wrap gap-2">
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">Java</span>
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">Dubbo</span>
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">Javassist</span>
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">字节码</span>
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">性能优化</span>
                                <span class="bg-blue-100 text-blue-800 text-xs px-3 py-1 rounded-full">分布式系统</span>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Content -->
                <div class="md:col-span-2 space-y-12">
                    <!-- Section 1 -->
                    <div id="section1" class="bg-white rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                            <h2 class="text-2xl font-bold text-white flex items-center">
                                <i class="fas fa-tachometer-alt mr-3"></i> 高效的字节码生成
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 mb-4">Javassist 是一种比 JDK 的 <code class="bg-gray-100 px-2 py-1 rounded text-sm">Proxy</code> 和 <code class="bg-gray-100 px-2 py-1 rounded text-sm">CGLIB</code> 更高效的字节码生成工具。它直接操作字节码，生成代理类的效率更高，尤其是在动态代理类的生成和方法调用方面，Javassist 的性能表现优于其他字节码生成工具。</p>
                            <div class="bg-blue-50 border-l-4 border-blue-500 p-4 mb-6">
                                <p class="text-blue-800"><i class="fas fa-lightbulb text-blue-500 mr-2"></i> <strong>关键优势：</strong> Javassist 允许开发者直接修改或生成字节码，这避免了使用反射进行方法调用的性能开销。</p>
                            </div>
                            <div class="mt-6">
                                <h3 class="text-lg font-semibold mb-3 text-gray-800">性能对比</h3>
                                <div class="overflow-x-auto">
                                    <table class="min-w-full bg-white rounded-lg overflow-hidden">
                                        <thead class="bg-gray-100">
                                            <tr>
                                                <th class="py-3 px-4 text-left text-gray-700">工具</th>
                                                <th class="py-3 px-4 text-left text-gray-700">生成速度</th>
                                                <th class="py-3 px-4 text-left text-gray-700">执行效率</th>
                                                <th class="py-3 px-4 text-left text-gray-700">内存占用</th>
                                            </tr>
                                        </thead>
                                        <tbody class="divide-y divide-gray-200">
                                            <tr>
                                                <td class="py-3 px-4">Javassist</td>
                                                <td class="py-3 px-4 text-green-600 font-medium">快</td>
                                                <td class="py-3 px-4 text-green-600 font-medium">高</td>
                                                <td class="py-3 px-4 text-green-600 font-medium">低</td>
                                            </tr>
                                            <tr>
                                                <td class="py-3 px-4">CGLIB</td>
                                                <td class="py-3 px-4">中等</td>
                                                <td class="py-3 px-4">中等</td>
                                                <td class="py-3 px-4">中等</td>
                                            </tr>
                                            <tr>
                                                <td class="py-3 px-4">JDK Proxy</td>
                                                <td class="py-3 px-4 text-red-600 font-medium">慢</td>
                                                <td class="py-3 px-4 text-red-600 font-medium">低</td>
                                                <td class="py-3 px-4">中等</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Section 2 -->
                    <div id="section2" class="bg-white rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                            <h2 class="text-2xl font-bold text-white flex items-center">
                                <i class="fas fa-user-friends mr-3"></i> 易于使用
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 mb-4">与其他字节码工具（如 ASM）相比，Javassist 提供了更高级别的 API，开发者可以直接通过字符串形式的 Java 代码来操作字节码，这大大简化了代理类的生成过程。</p>
                            <p class="text-gray-700 mb-6">Javassist 提供的 API 使得开发者能够灵活地动态修改类的字节码内容，无需深度理解字节码结构。</p>
                            
                            <div class="grid md:grid-cols-2 gap-6 mb-6">
                                <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                    <h4 class="font-bold text-gray-800 mb-3 flex items-center">
                                        <i class="fas fa-check-circle text-green-500 mr-2"></i> 高级API示例
                                    </h4>
                                    <pre class="bg-gray-800 text-gray-100 p-4 rounded text-sm overflow-x-auto">
<code>// 创建新类
ClassPool pool = ClassPool.getDefault();
CtClass cc = pool.makeClass("HelloWorld");

// 添加方法
CtMethod method = CtNewMethod.make(
    "public void sayHello() { System.out.println(\"Hello!\"); }", 
    cc
);
cc.addMethod(method);

// 生成字节码
Class<?> clazz = cc.toClass();
Object instance = clazz.newInstance();
Method m = clazz.getMethod("sayHello");
m.invoke(instance); // 输出: Hello!</code></pre>
                                </div>
                                <div class="bg-gray-50 p-5 rounded-lg border border-gray-200">
                                    <h4 class="font-bold text-gray-800 mb-3 flex items-center">
                                        <i class="fas fa-project-diagram text-blue-500 mr-2"></i> 工作流程
                                    </h4>
                                    <div class="mermaid mb-4">
                                        graph TD
                                            A[定义类结构] --> B[添加方法/字段]
                                            B --> C[修改字节码]
                                            C --> D[生成Class对象]
                                            D --> E[动态加载]
                                    </div>
                                    <p class="text-sm text-gray-600">Javassist简化了字节码操作流程，开发者可以像编写普通Java代码一样操作字节码。</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Section 3 -->
                    <div id="section3" class="bg-white rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                            <h2 class="text-2xl font-bold text-white flex items-center">
                                <i class="fas fa-puzzle-piece mr-3"></i> 与Dubbo的契合度
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 mb-4">Dubbo 作为一个分布式服务框架，需要在运行时大量地生成和管理代理类，Javassist 的高效性和灵活性使得它非常适合 Dubbo 的使用场景。</p>
                            <p class="text-gray-700 mb-6">Javassist 在类加载和代理类生成方面的速度很快，这对于需要频繁生成代理类的分布式系统来说，能够显著提升系统的整体性能。</p>
                            
                            <div class="bg-blue-50 p-6 rounded-lg mb-6">
                                <h3 class="text-lg font-semibold mb-4 text-gray-800">Dubbo中的代理类生成流程</h3>
                                <div class="space-y-4">
                                    <div class="flex items-start">
                                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 mr-4">
                                            <i class="fas fa-1"></i>
                                        </div>
                                        <div>
                                            <h4 class="font-medium text-gray-800">服务引用</h4>
                                            <p class="text-gray-600 text-sm">Dubbo在客户端引用服务时生成代理类</p>
                                        </div>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 mr-4">
                                            <i class="fas fa-2"></i>
                                        </div>
                                        <div>
                                            <h4 class="font-medium text-gray-800">代理生成</h4>
                                            <p class="text-gray-600 text-sm">Javassist根据服务接口生成代理类字节码</p>
                                        </div>
                                    </div>
                                    <div class="flex items-start">
                                        <div class="flex-shrink-0 h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center text-blue-600 mr-4">
                                            <i class="fas fa-3"></i>
                                        </div>
                                        <div>
                                            <h4 class="font-medium text-gray-800">方法调用</h4>
                                            <p class="text-gray-600 text-sm">代理类处理远程调用逻辑，透明化RPC细节</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Section 4 -->
                    <div id="section4" class="bg-white rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                            <h2 class="text-2xl font-bold text-white flex items-center">
                                <i class="fas fa-shield-alt mr-3"></i> 成熟度和社区支持
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 mb-4">Javassist 在 Java 社区中有着广泛的应用，不仅仅是 Dubbo，其他很多框架也选择了 Javassist 作为字节码操作工具。这说明了它的成熟度和稳定性。</p>
                            <p class="text-gray-700 mb-6">Javassist 具有良好的社区支持，持续的更新和优化确保了它在性能和功能上的领先地位。</p>
                            
                            <div class="grid md:grid-cols-2 gap-6">
                                <div>
                                    <h3 class="text-lg font-semibold mb-3 text-gray-800">采用Javassist的知名项目</h3>
                                    <ul class="space-y-2">
                                        <li class="flex items-center">
                                            <i class="fas fa-check text-green-500 mr-2"></i> Apache Dubbo
                                        </li>
                                        <li class="flex items-center">
                                            <i class="fas fa-check text-green-500 mr-2"></i> Hibernate
                                        </li>
                                        <li class="flex items-center">
                                            <i class="fas fa-check text-green-500 mr-2"></i> Spring Framework
                                        </li>
                                        <li class="flex items-center">
                                            <i class="fas fa-check text-green-500 mr-2"></i> JBoss
                                        </li>
                                        <li class="flex items-center">
                                            <i class="fas fa-check text-green-500 mr-2"></i> Mockito
                                        </li>
                                    </ul>
                                </div>
                                <div>
                                    <h3 class="text-lg font-semibold mb-3 text-gray-800">版本历史</h3>
                                    <div class="space-y-4">
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-8 w-8 rounded-full bg-blue-500 text-white flex items-center justify-center mr-3">
                                                3
                                            </div>
                                            <div>
                                                <p class="text-sm font-medium">2020 - 至今</p>
                                                <p class="text-xs text-gray-600">持续优化，支持最新Java特性</p>
                                            </div>
                                        </div>
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-8 w-8 rounded-full bg-blue-400 text-white flex items-center justify-center mr-3">
                                                2
                                            </div>
                                            <div>
                                                <p class="text-sm font-medium">2008 - 2020</p>
                                                <p class="text-xs text-gray-600">广泛采用，成为主流字节码工具</p>
                                            </div>
                                        </div>
                                        <div class="flex items-center">
                                            <div class="flex-shrink-0 h-8 w-8 rounded-full bg-blue-300 text-white flex items-center justify-center mr-3">
                                                1
                                            </div>
                                            <div>
                                                <p class="text-sm font-medium">2000 - 2008</p>
                                                <p class="text-xs text-gray-600">初始版本，东京工业大学开发</p>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- Section 5 -->
                    <div id="section5" class="bg-white rounded-xl shadow-lg overflow-hidden">
                        <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                            <h2 class="text-2xl font-bold text-white flex items-center">
                                <i class="fas fa-balance-scale mr-3"></i> 与其他工具的对比
                            </h2>
                        </div>
                        <div class="p-6">
                            <p class="text-gray-700 mb-6">在Java生态系统中，有多种字节码操作工具可供选择，每种工具都有其优缺点。Javassist在某些关键方面优于其他工具，特别是对于Dubbo这样的分布式服务框架。</p>
                            
                            <div class="mermaid mb-8">
                                pie
                                    title 字节码工具在Dubbo场景下的选择考量
                                    "性能" : 40
                                    "易用性" : 30
                                    "灵活性" : 20
                                    "社区支持" : 10
                            </div>
                            
                            <div class="space-y-6">
                                <div class="border-l-4 border-blue-500 pl-4">
                                    <h3 class="text-lg font-semibold mb-2 text-gray-800">与 JDK Proxy 的对比</h3>
                                    <p class="text-gray-700">JDK Proxy 只能代理接口，而 Javassist 可以代理类和接口。对 Dubbo 而言，Javassist 提供了更多的灵活性。</p>
                                </div>
                                
                                <div class="border-l-4 border-blue-500 pl-4">
                                    <h3 class="text-lg font-semibold mb-2 text-gray-800">与 CGLIB 的对比</h3>
                                    <p class="text-gray-700">CGLIB 通过继承来生成代理类，生成的字节码较为复杂，性能稍逊于 Javassist。而且 CGLIB 在处理 final 类和方法时存在限制，而 Javassist 没有这些限制。</p>
                                </div>
                                
                                <div class="border-l-4 border-blue-500 pl-4">
                                    <h3 class="text-lg font-semibold mb-2 text-gray-800">与 ASM 的对比</h3>
                                    <p class="text-gray-700">ASM 提供了更底层的字节码操作能力，性能极高，但学习曲线陡峭。Javassist 在性能与易用性之间取得了更好的平衡，更适合Dubbo这样需要快速开发和维护的项目。</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Conclusion -->
    <section class="py-16 px-4 bg-gradient-to-br from-blue-50 to-gray-50">
        <div class="container mx-auto max-w-5xl">
            <div class="bg-white rounded-xl shadow-lg overflow-hidden">
                <div class="bg-gradient-to-r from-blue-600 to-blue-700 p-6">
                    <h2 class="text-2xl font-bold text-white flex items-center">
                        <i class="fas fa-star mr-3"></i> 总结
                    </h2>
                </div>
                <div class="p-6 md:p-8">
                    <div class="prose max-w-none">
                        <p class="text-gray-700 mb-6">综合来看，Dubbo选择Javassist作为默认的字节码生成工具是一个经过深思熟虑的决定。Javassist在性能、易用性和灵活性三方面取得了良好的平衡，完美契合了Dubbo作为高性能分布式服务框架的需求。</p>
                        
                        <div class="grid md:grid-cols-3 gap-6 mb-8">
                            <div class="bg-blue-50 p-5 rounded-lg">
                                <div class="text-blue-600 text-3xl mb-3">
                                    <i class="fas fa-trophy"></i>
                                </div>
                                <h3 class="font-bold text-gray-800 mb-2">性能王者</h3>
                                <p class="text-gray-600 text-sm">在代理类生成和调用效率上领先其他工具</p>
                            </div>
                            <div class="bg-blue-50 p-5 rounded-lg">
                                <div class="text-blue-600 text-3xl mb-3">
                                    <i class="fas fa-user-shield"></i>
                                </div>
                                <h3 class="font-bold text-gray-800 mb-2">开发友好</h3>
                                <p class="text-gray-600 text-sm">高级API降低学习曲线，提高开发效率</p>
                            </div>
                            <div class="bg-blue-50 p-5 rounded-lg">
                                <div class="text-blue-600 text-3xl mb-3">
                                    <i class="fas fa-heartbeat"></i>
                                </div>
                                <h3 class="font-bold text-gray-800 mb-2">生态成熟</h3>
                                <p class="text-gray-600 text-sm">经过众多项目验证，社区支持强大</p>
                            </div>
                        </div>
                        
                        <p class="text-gray-700">随着Dubbo在云计算和微服务领域的广泛应用，Javassist作为其核心技术组件之一，将继续为分布式系统的高性能通信提供可靠支持。这种技术选型的成功也为其他框架的设计提供了宝贵参考。</p>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: { 
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            },
            pie: {
                useWidth: 400,
                showDataLabels: true
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
        
        // 卡片悬停效果
        const cards = document.querySelectorAll('.card');
        cards.forEach(card => {
            card.addEventListener('mouseenter', () => {
                card.style.transition = 'transform 0.3s ease, box-shadow 0.3s ease';
            });
        });
    </script>
</body>
</html>
```